package models;

import parser.generic.Node;

public class Instance extends Node {

	private String name;
	private String type;
	private Fields fields;

	public Instance(String name, String type, Fields fields) {
		this.name = name;
		this.type = type;
		this.fields = fields;
	}

	@Override
	public String toString() {
		return "object " + name + " : " + type + " = {\n" + fields + "\n}";
	}

	public String getName() {
		return name;
	}

	public String toK(String deep) {
		return deep + "<instance>\n" + deep + "\t" +
				"<instName> " + name + " </instName>\n"  + deep + "\t" +
				"<ofClass> " + type + " </ofClass>\n"  + deep + "\t" +
				"<attributes>\n" + fields.toK(deep + "\t\t") + "\n" + deep + "\t\t.Map" + "\n" + deep + "\t</attributes>\n" + 
				deep + "</instance>";
	}
}
